package com.googlecode.wmlynar.javadoctc.reportgen;

import com.googlecode.wmlynar.javadoctc.analyzers.code.JavaDocScanner;
import com.googlecode.wmlynar.javadoctc.analyzers.tests.UnitTestScanner;
import com.googlecode.wmlynar.javadoctc.domain.JavaDocClass;
import com.googlecode.wmlynar.javadoctc.domain.JavaDocClassPool;
import com.googlecode.wmlynar.javadoctc.domain.JavaDocMethod;
import com.googlecode.wmlynar.javadoctc.util.MyFileUtil;

public class CoverageReporter {
	
	public static void main(String[] args) {
		JavaDocClassPool unitTestClasses = UnitTestScanner.scanForUnitTestMethods();
		JavaDocClassPool javadocTestClasses = JavaDocScanner.scanForJavadocClasses();
		
		// remove matching phrases from javadoc
		
		// for all javadoc test classes copy javadoc to untested javadoc
		for(JavaDocClass e : javadocTestClasses.getClassList()) {
			for(JavaDocMethod m : e.getMethodList()) {
				m.setTestedJavadoc(m.getJavadoc());
			}
		}
		
		// for all unit test classes move javadoc phrases to tested javadoc

		ReportGenerator reportGen = new ReportGenerator();
		
		String report = reportGen.generateListClasses(javadocTestClasses);
		
		MyFileUtil.writeString("output", "output.html", report);
		
        System.out.println(report);
	}

}
